package com.hunlian.makelove.presenter;

import android.content.Context;

import com.hunlian.makelove.bean.PersonDetailBean;
import com.hunlian.makelove.common.AppConfig;
import com.hunlian.makelove.iview.IDetailUser;
import com.hunlian.makelove.net.NetVisitCallback;
import com.hunlian.makelove.net.api.DetailServiceVisit;
import com.hunlian.makelove.tools.MyToast;


/**
 * 用户详情
 * @author zealjiang
 * @time 2016/9/25 16:23
 */
public class DetailPresenter extends BasePresenter<IDetailUser> {
    public DetailPresenter(IDetailUser from) {
        super(from);
    }


    public void saveIntendCustomer(Context context,String tarId,String ReplacementID, String json){
        //LogUtil.e(TAG, UIUtils.getUrl(params));
        baseView.showDialog();

        DetailServiceVisit visit = new DetailServiceVisit(context);
        visit.setParamters(AppConfig.getInstance().getLoginedUserId(),tarId);
        //System.out.println("用户详情请求参数：" + visit.getParamter());
        visit.getResult(new NetVisitCallback<PersonDetailBean,Object>(context) {

            @Override
            public void onSuccess(PersonDetailBean data) {
                baseView.dismissDialog();
                if (data == null) return;
                //baseView.saveSuccend();
            }

            @Override
            public void onFailure(String errorEvent, String message,Object obj) {
                super.onFailure(errorEvent, message,obj);
                baseView.dismissDialog();
                MyToast.showShort(message);
            }

        });
    }

}
